
namespace Commons.Models.Settings.Matchers.Operators.Relational
{
	public class RelationalOperatorSupport
	{
		public static string GetString(object v)
		{
			if (v == null)
			{
				return "";
			}
			else if (v is bool)
			{
				return v.ToString().ToLower();
			}
			else
			{
				return v.ToString();
			}
		}

		public static double GetDouble(object v)
		{
			double number;
			if (double.TryParse(GetString(v), out number))
			{
				return number;
			}
			else
			{
				throw new System.Exception("Value " + v + " is not numeric");
			}
		}
	}
}

